package cn.wp.ewallet.upms.service.impl;

import cn.hutool.core.util.StrUtil;
import cn.wp.ewallet.upms.dao.LoginLogDao;
import cn.wp.ewallet.upms.service.LoginLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class LoginLogServiceImpl implements LoginLogService {

    @Autowired
    LoginLogDao loginLogDao;


    @Override
    public int saveLoginEquipment(String account, String uuid) {
        return loginLogDao.insertLoginEquipment(account,uuid);
    }

    @Override
    public String getLastLoginEquipment(String account) {
        return loginLogDao.selectLastLoginEquipment(account);
    }

    @Override
    public boolean checkLoginEquipment(String account, String uuid) {
        String storeUUID = this.getLastLoginEquipment(account);
        if(StrUtil.isBlank(storeUUID)) {
            return true;
        }
        return storeUUID.equals(uuid);
    }
}
